﻿//7265
//依赖项：
//mfcvcr100.dll;kernel32.dll


#include "../common/serialport.h"
#include "../common/read_dev_head.h"

//作为已知类型


serialPort com;
static OVERLAPPED ov= { 0 } ;


//dll入口
BOOL APIENTRY DllMain( HANDLE hModule,
	DWORD  ul_reason_for_call, 
	LPVOID lpReserved
	)
{
	switch( ul_reason_for_call )
	{
	case DLL_PROCESS_ATTACH:break;
	case DLL_THREAD_ATTACH:break;
	case DLL_THREAD_DETACH:break;
	case DLL_PROCESS_DETACH:
		com.CloseCom();
	}
	return TRUE;
}


//
bool getx(char*dat) 
{
	send("X.\r");
	//Sleep(500);
	waitcom();
	return read(dat);
}
bool gety(char*dat) 
{
	if(!send("Y.\r"))
	{
		return false;
	}
	waitcom();
	return read(dat);
}
bool getall(char*dat) 
{
	if(!send("X.;Y.\r"))
	{
		return false;
	}
	waitcom();
	return read(dat);
}


extern "C" __declspec(dllexport) void setupReaderEngine(readerInterface& dest)
{
	dest.openCom=openCom;
	dest.closeCom=closeCom;
		//com.SetMask(EV_RXCHAR);

	dest.pgetx=getx;
	dest.pgety=gety;
	dest.pgetall=getall;
}


